package com.fhz.hilt.ui;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.ViewModelProvider;

import android.os.Bundle;

import com.fhz.hilt.R;
import com.fhz.hilt.api.FengServer;
import com.fhz.hilt.datasource.local.UserLocalDataSource;
import com.fhz.hilt.datasource.remote.UserRemoteDataSource;
import com.fhz.hilt.repository.UserRepository;
import com.fhz.hilt.viewmodel.LoginViewModel;
import com.fhz.hilt.viewmodel.LoginViewModelFactory;

import retrofit2.Retrofit;

public class MainActivity extends AppCompatActivity {

    private LoginViewModel loginViewModel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl("https://example.com")
                .build();

        UserRemoteDataSource remoteDataSource = new UserRemoteDataSource(retrofit);
        UserLocalDataSource localDataSource = new UserLocalDataSource();

        UserRepository userRepository = new UserRepository(localDataSource, remoteDataSource);


        loginViewModel = new ViewModelProvider(this,new LoginViewModelFactory(userRepository)).get(LoginViewModel.class);

    }
}